package cn.iocoder.yudao.module.fengdong.smartelderly.dal.mysql.oldmanpointrecord;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.fengdong.smartelderly.dal.dataobject.oldmanpointrecord.OldmanPointRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.fengdong.smartelderly.controller.admin.oldmanpointrecord.vo.*;

/**
 * 老人积分记录 Mapper
 *
 * @author 沣东养老院管理员
 */
@Mapper
public interface OldmanPointRecordMapper extends BaseMapperX<OldmanPointRecordDO> {

    default PageResult<OldmanPointRecordDO> selectPage(OMPointRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OldmanPointRecordDO>()
                .eqIfPresent(OldmanPointRecordDO::getBizId, reqVO.getBizId())
                .eqIfPresent(OldmanPointRecordDO::getBizType, reqVO.getBizType())
                .eqIfPresent(OldmanPointRecordDO::getTitle, reqVO.getTitle())
                .eqIfPresent(OldmanPointRecordDO::getDescription, reqVO.getDescription())
                .eqIfPresent(OldmanPointRecordDO::getPoint, reqVO.getPoint())
                .eqIfPresent(OldmanPointRecordDO::getTotalPoint, reqVO.getTotalPoint())
                .betweenIfPresent(OldmanPointRecordDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OldmanPointRecordDO::getOldmanId, reqVO.getOldmanId())
                .orderByDesc(OldmanPointRecordDO::getId));
    }

    default List<OldmanPointRecordDO> selectList(OMPointRecordExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<OldmanPointRecordDO>()
                .eqIfPresent(OldmanPointRecordDO::getBizId, reqVO.getBizId())
                .eqIfPresent(OldmanPointRecordDO::getBizType, reqVO.getBizType())
                .eqIfPresent(OldmanPointRecordDO::getTitle, reqVO.getTitle())
                .eqIfPresent(OldmanPointRecordDO::getDescription, reqVO.getDescription())
                .eqIfPresent(OldmanPointRecordDO::getPoint, reqVO.getPoint())
                .eqIfPresent(OldmanPointRecordDO::getTotalPoint, reqVO.getTotalPoint())
                .betweenIfPresent(OldmanPointRecordDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OldmanPointRecordDO::getOldmanId, reqVO.getOldmanId())
                .orderByDesc(OldmanPointRecordDO::getId));
    }

}
